/**
 * Copyright 2016-2017 TVI Go Easy.
 * Created on 2017/4/18 14:31
 */
package org.mechanic.fund.domain.product;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.mechanic.fund.domain.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 基准指数实体类
 *
 * @author mechanic
 * @version 0.0.1
 */
@Entity
@Table(name = "product_stocks_index")
public class ProductStocksIndex extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 8023944453629922150L;
    /**
     * 基准指数类型
     */
    @JsonIgnoreProperties(value = {"sort"})
    @ManyToOne
    @JoinColumn(name = "product_stocks_index_type_id")
    private ProductStocksIndexType productStocksIndexType;
    /**
     * 最新净值
     */
    @Column(name = "newest_netvalue")
    private BigDecimal newestNetvalue;
    /**
     * 最后更新时间
     */
    @Column(name = "lastest_date", columnDefinition = "TIMESTAMP")
    private LocalDate lastestDate;

    public ProductStocksIndex() {
    }

    public ProductStocksIndex(
      String id,
      ProductStocksIndexType productStocksIndexType,
      BigDecimal newestNetvalue,
      LocalDate lastestDate,
      String createUser,
      LocalDateTime createTime,
      String updateUser,
      LocalDateTime updateTime) {
        this.id = id;
        this.productStocksIndexType = productStocksIndexType;
        this.newestNetvalue = newestNetvalue;
        this.lastestDate = lastestDate;
        this.createUser = createUser;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
    }

    public ProductStocksIndexType getProductStocksIndexType() {
        return productStocksIndexType;
    }

    public void setProductStocksIndexType(ProductStocksIndexType productStocksIndexType) {
        this.productStocksIndexType = productStocksIndexType;
    }

    public BigDecimal getNewestNetvalue() {
        return newestNetvalue;
    }

    public void setNewestNetvalue(BigDecimal newestNetvalue) {
        this.newestNetvalue = newestNetvalue;
    }

    public LocalDate getLastestDate() {
        return lastestDate;
    }

    public void setLastestDate(LocalDate lastestDate) {
        this.lastestDate = lastestDate;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}
